<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
	<head> 
    <meta charset="UTF-8">
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
    <link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
    <link rel="stylesheet" href="${ctxStatic}/css/layerSm.css"> 
    <script>
    
    $(function(){
    	
        var form = $("#inputForm");  
        form.validate();//验证指定的表单
        $("#confirmBtn").click(function(){
        	if (form.valid()) {//如果表单验证成功，则进行提交。  
            $("#showHtml").addClass("showHtml");
            $("#confirmPage").css("display","block");
            $("#editPage").css("display","none");
            $('.showHtml').find('input,radio,textarea').attr('disabled',true);
            return false;
        	}
         });
    });

    //保存方法
    var saveForm={
         t:null,
         save:function(t){
             $(t).attr("disabled",true);
             this.t=t;
             $('.showHtml').find('input,radio,textarea').attr('disabled',false);
      	     var params = $("#inputForm").serialize();
             $.post("${ctx}/personnel/group/save",params,function(result){
            	 // 提示信息
                 tipParent(result.message);
                 // 返回状态
                 if(result.statusCode==STATUSCODEOK){
                    // 刷新页面
                    window.parent.frames[0].searchListForm();
                    closeWin(); 
                 }else{
                      $(saveForm.t).attr("disabled",false);
                 }
             },'json');
         } 
    }
    </script> 
    
    </head>
	<body>
	<!-- 创建页面head部 -->
		<div id="editPage" class="layerHeader clearfix">
		
			<c:choose>
		        <c:when test="${personnel.id!=null && personnel.id!=''}">
		             <!-- 修改编辑 -->
		            <p class="headerTitle"><spring:message code="personnel_head_edit_info"/></p>
		        </c:when>
		        <c:otherwise>
		             <!-- 新建 -->
		            <p class="headerTitle"><spring:message code="personnel_head_create_info"/></p>
		        </c:otherwise>
		    </c:choose>
	
		    <div class="headerButton clearfix">
		       <button type="button" id="confirmBtn"><spring:message code="btn_ok"/></button>
		       <button type="button" onclick="closeWin()"><spring:message code="btn_cancle"/></button>
		    </div>
		</div>
	
		<!-- 确认页面head部 -->
		<div id="confirmPage" class="layerHeader clearfix" style="display:none">
			<p class="headerTitle"><spring:message code="personnel_head_confirm_info"/></p>
		    <div class="headerButton clearfix">
		    	<shiro:hasPermission name="personnel:group:edit">
		        <button type="button" id="saveBtn" onclick="saveForm.save(this)"><spring:message code="common_save"/></button>
				</shiro:hasPermission>
		        <button type="button" onclick="closeWin()"><spring:message code="btn_cancle"/></button>
		    </div>
		</div>
	
    	<form id="inputForm" method="post" >
    
    	<input type="hidden" id="id" name="id" value="${personnel.id}"/>
    
		<div id="showHtml">
			<div class="smList">
			    <div class="items clearfix">
		        	<div class="col-50 clearfix haveToBox">
		        	    <!--分组名称-->
		                <p class="tit"><spring:message code="personnel_group_name" /></p>
		                <input id="groupName" name="groupName" value="${personnel.groupName}" data-rule-required="true" data-msg-required="<spring:message code="personnel_err_msg_groupName"/>">
			            <p class="haveTo">*</p>
		            </div>
		        </div>
			    <div class="items clearfix">
		        	<div class="col-50 clearfix">
		        	    <!--状态-->
		                <p class="tit"><spring:message code="personnel_create_enableFlag" /></p>
		                <div class="labelBox">
		                    <!--启用-->
		                    <label> <input type="radio" name="enableFlag"
								checked='checked' value="1"
								<c:if test="${personnel.enableFlag eq 1}">checked="checked"</c:if>
								class="rast" /> <spring:message code="personnel_open" /> 
							</label>
							<!--停用-->
							<label><input type="radio" name="enableFlag" value="0"
								<c:if test="${personnel.enableFlag eq 0}">checked="checked"</c:if>
								class="rast" /> <spring:message code="personnel_close" /> 
						    </label>
		                </div>
		            </div>
		        </div>
		        <div class="items clearfix">
		        	<div class="clearfix">
		        	    <!--描述-->
		                <div class="tit"><spring:message code="personnel_create_description" />
		                	<p class="textareaTxt">
								<spring:message code="personnel_note" />
							</p>
		                </div>
		                <textarea  id="groupDescription" name="groupDescription" value="${personnel.groupDescription}" 
		                    style="width: 518px;height: 130px;">${personnel.groupDescription}</textarea>
		            </div>
		        </div>  
			</div>
		</div>
		</form>
	</body>
</html>
